<?php
class Admin_Model_DbTable_Profile extends Zend_Db_Table_Abstract {
	protected $_name = 'profile';
	public function addProfile($admin_id, $address, $occupation, $dob, $email, $phone_number, $status) {
		$data = array (
				'ADMIN_ID' => $admin_id,
				'ADDRESS' => $address,
				'OCCUPATION' => $occupation,
				'DOB' => $dob,
				'EMAIL' => $email,
				'PHONE_NUMBER' => $phone_number,
				'STATUS' => $status 
		);
		return $this->insert ( $data );
	}
	public function updateProfile($id, $admin_id, $address, $occupation, $dob, $email, $phone_number, $status) {
		$data = array (
				'ADMIN_ID' => $admin_id,
				'ADDRESS' => $address,
				'OCCUPATION' => $occupation,
				'DOB' => $dob,
				'EMAIL' => $email,
				'PHONE_NUMBER' => $phone_number,
				'STATUS' => $status 
		);
		return $this->update ( $data, "ID = $id" );
	}
	public function updateStatus($id, $status) {
		$data = array (
				'STATUS' => $status 
		);
		return $this->update ( $data, "ID = $id" );
	}
	public function removeProfile($id) {
		return $this->delete ( "ID = $id" );
	}
	public function getAllProfile() {
		return $this->fetchAll ( "STATUS = 1" )->toArray ();
	}
	public function getProfileByAdminId($admin_id, $status) {
		return $this->fetchAll("ADMIN_ID = $admin_id AND STATUS = $status")->toArray();
	}
	public function getProfileByStatus($status) {
		return $this->fetchAll("STATUS = $status")->toArray();
	}
}

